var mongoose=require('mongoose');
var moment=require('moment');
var users=mongoose.Schema({
    user_name:{type:String,required:true},
    user_dir:{type:String},
    user_id:{type:mongoose.Schema.Types.ObjectId},//    <th scope="col">规格</th>
    user_token:{type:String,required:true},
    password:{type:String,required:true},
    last_login_time:{type:String},
    create_time:[{type:String}],
})
users.pre('save',function (next) {
    let nowTime = moment().format('YYYY-MM-DD HH:mm:ss');
    this.createAt = nowTime;
    next();
});
users.pre('validate', function (next) {
  //  console.log('validate');
    next();
});
var usersModel=mongoose.model("usersModel",users);

module.exports=usersModel;